<template>
	<view>
		<view class="navtit">
			<view class="navlist">
				<view class="navitem" v-for="(item,index) in catebox" :key="index" @click="changenav(item,index)" 
				:style="{'background':index==navindex?'#FF8A9B':'','color':index==navindex?'#FFF':'#FF8A9B'}">
					{{item}}
				</view>
			</view>
		</view>
		<view style="height: 125rpx;"></view>
		<!-- 我的评价 -->
		<view class="listbox" v-if="navindex==0" v-for="(item,index) in list" :key="index">
			<view class="userinfo">
				<!-- <view class="logobox">
					<image src="../../static/logo.png"></image>
				</view> -->
				<view class="rightbox">
					<view class="onebox">
						<view class="twobox">
							<view>专业度：</view>
							<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="item.major" :size="15"  style="margin-right: 20rpx;"/>
							<view>态度：</view>
							<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="item.manner" :size="15"/>
						</view>
						<view class="timebox">{{dateFormat(item.create_time)}}</view>
					</view>
					
				</view>
			</view>
			<view class="contentbox">
				{{item.content}}
			</view>
			<view class="imgbox">
				<view class="imglist" v-for="(imgitem,imgindex) in item.img.split('|')" :key="imgindex">
					<image :src="imgitem"></image>
				</view>
			</view>
			<view class="classname">{{item.course_name}}</view>
			<view class="specbox">
				<view class="specitem" v-for="(labitem,labindex) in item.label" :key="labindex">
					{{labitem.major_name}}
				</view>
			</view>
			<!-- <view class="teachercomment">
				<view>老师对我的评价：：</view>
				<view class="starbox">
					<view>学习成果：</view>
					<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="2" :size="15" style="margin-right: 20rpx;"/>
					<view>作业方面：</view>
					<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="2" :size="15"/>
				</view>
			</view> -->
		</view>
		<!--老师对我（学生）的评价-->
		<view class="listbox" v-if="navindex==1" v-for="(item,index) in list" :key="index">
			<view class="userinfo">
				<!-- <view class="logobox">
					<image src="../../static/logo.png"></image>
				</view> -->
				<view class="rightbox">
					<view class="onebox">
						<view class="namebox" style="color: #888888;font-size: 24rpx;">{{item.course_name}}</view>
						<view class="timebox">{{dateFormat(item.create_time)}}</view>
					</view>
					<!-- <view class="twobox">
						<view>专业度：</view>
						<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="2" :size="15"  style="margin-right: 20rpx;"/>
						<view>态度：</view>
						<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="2" :size="15"/>
					</view> -->
				</view>
			</view>
			<view class="teachercomment" style="margin-top: 0;">
				<view>老师对我的评价：：</view>
				<view class="starbox">
					<view>学习成果：</view>
					<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="item.major" :size="15" style="margin-right: 20rpx;"/>
					<view>作业方面：</view>
					<uni-rate :readonly="true" color="#bbb" active-color="#FF6178" :value="item.manner" :size="15"/>
				</view>
			</view>
			<view class="contentbox">
				{{item.content}}
			</view>
			<view class="imgbox">
				<view class="imglist" v-for="(imgitem,imgindex) in item.img.split('|')" :key="imgindex">
					<image :src="imgitem"></image>
				</view>
			</view>
			<view class="specbox">
				<view class="specitem" v-for="(labitem,labindex) in item.label" :key="labindex">
					{{labitem.major_name}}
				</view>
			</view>
			<!-- <view class="classname">一年级上学期数学系统班—综合实践1</view> -->
			
		</view>
		<kong v-if="list.length==0"></kong>
	</view>
</template>

<script>
	import kong from '../../components/kong.vue'
	export default {
		components:{
			kong
		},
		data() {
			return {
				catebox:['我的评价','评价我的'],
				navindex:'',
				list:[],
				is_data:true,
			}
		},
		onLoad() {
			this.getlist()
		},
		onReachBottom() {
			this.is_data&&this.getlist()
		},
		methods: {
			changenav(item,index){
				this.navindex = index
				this.list=[]
				this.page=1
				this.getlist()
			},
			getlist(){
				this.$http({
					url:'/api/course/my_eval',
					data:{
						page:this.page,
						limit:15,
						eval_status:this.navindex+1,//1我的评价2评价我的
					}
				}).then(res=>{
					if(res.data.length){
						this.list.push(...res.data)
						this.page++
						return
					}
					this.is_data = false
					
				})
			},
			dateFormat: function(value) {           
			                var date = new Date(value*1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
			                var year = date.getFullYear();
			                var month = ("0" + (date.getMonth() + 1)).slice(-2);
			                var sdate = ("0" + date.getDate()).slice(-2);
			                var hour = ("0" + date.getHours()).slice(-2);
			                var minute = ("0" + date.getMinutes()).slice(-2);
			                var second = ("0" + date.getSeconds()).slice(-2);
			                // 拼接
			                var result = year + "-" + month + "-" + sdate //+ "日 "// + hour + ":" + minute //+ ":" + second;
			                // 返回
			                return result;
			            },
		}
	}
</script>

<style lang="scss" scoped>
	.navtit{
		width: 750rpx;
		height: 112rpx;
		background: #FFFFFF;
		border-radius: 0rpx 0rpx 10rpx 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		top: 0;
		z-index: 99;
		.navlist{
			width: 432rpx;
			height: 70rpx;
			border-radius: 36rpx;
			border: 2rpx solid #FF8A9B;
			background-color: #FFF;
			display: flex;
			align-items: center;
			.navitem{
				width: 216rpx;
				height: 70rpx;
				// background: #FF8A9B;
				border-radius: 30rpx;
				text-align: center;
				line-height: 70rpx;
			}
		}
	}
	.listbox{
		width: 690rpx;
		padding: 0 30rpx 20rpx 30rpx;
		background-color: #FFF;
		margin-top: 24rpx;
		.userinfo{
			display: flex;
			align-items: center;
			height: 100rpx;
			.logobox{
				width: 86rpx;
				image{
					width: 70rpx;
					height: 70rpx;
					border-radius: 100%;
				}
			}
			.rightbox{
				width: 690rpx;
				.onebox{
					width: 690rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					.twobox{
						display: flex;
						align-items: center;
						font-size: 24rpx;
						font-family: Source Han Sans CN-Regular, Source Han Sans CN;
						font-weight: 400;
						color: #555555;
						margin-top: 10rpx;
					}
					.namebox{
						width: 460rpx;
						-webkit-line-clamp: 1;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						overflow: hidden;
						text-overflow: ellipsis;
					}
					.timebox{
						font-size: 28rpx;
						font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
						font-weight: normal;
						color: #555555;
					}
				}
				
			}
			
		}
		.contentbox{
			font-size: 28rpx;
			font-family: Source Han Sans CN-Medium, Source Han Sans CN;
			font-weight: 500;
			color: #222222;
			margin: 24rpx 0;
		}
		.imgbox{
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			.imglist{
				width: 33.3%;
				text-align: center;
				image{
					width: 218rpx;
					height: 218rpx;
					border-radius: 8rpx;
					margin-bottom: 10rpx;
				}
			}
		}
		.specbox{
					display: flex;
					align-items: center;
					margin: 24rpx 0 0 0;
					flex-wrap: wrap;
					
					.specitem{
						width: fit-content;
						height: 50rpx;
						background: linear-gradient(90deg, #FEF0E5 0%, #FFE0CD 100%);
						border-radius: 8rpx 26rpx 26rpx 26rpx;
						line-height: 50rpx;
						font-size: 28rpx;
						font-family: Source Han Sans CN-Regular, Source Han Sans CN;
						font-weight: 400;
						color: #A07150;
						padding: 0 16rpx;
						margin-right: 16rpx;
						margin-top: 10rpx;
					}
				}
		.classname{
			font-size: 24rpx;
			font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
			font-weight: normal;
			color: #888888;
		}
		.teachercomment{
			width: 630rpx;
			padding:30rpx;
			border-radius: 24rpx;
			background: #FFF8F9;
			font-size: 28rpx;
			font-family: Source Han Sans CN-Medium, Source Han Sans CN;
			font-weight: 500;
			color: #FF6178;
			margin-top: 40rpx;
			.starbox{
				display: flex;
				align-items: center;
				font-size: 24rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #555555;
				margin-top: 20rpx;
			}
		}
	}

</style>
